package cn.cool.springframework.test.bean;

import cn.cool.springframework.beans.BeansException;
import cn.cool.springframework.beans.factory.*;
import cn.cool.springframework.context.ApplicationContext;
import cn.cool.springframework.context.ApplicationContextAware;
import lombok.Data;

@Data
public class UserService implements BeanFactoryAware, BeanClassLoaderAware, BeanNameAware, ApplicationContextAware {
    private String uId;
    private String company;
    private String location;
    private UserDao userDao;

    public String queryUserInfo() {
        return userDao.queryUserName(uId) + ",公司：" + company + "，地点:" + location;
    }

    @Override
    public void setBeanClassLoader(ClassLoader classLoader) {
        System.out.println("setBeanClassLoader");
    }

    @Override
    public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
        System.out.println("setBeanFactory");
    }

    @Override
    public void setBeanName(String name) {
        System.out.println("setBeanName");
    }

    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        System.out.println("setApplicationContext");
    }
}
